CompressImage
TheCompressImage
function allows your application to compress a single-frame image that is currently stored as a pixel map structure.
pascal OSErr CompressImage (PixMapHandle src, const Rect *srcRect, CodecQ quality, CodecType cType, ImageDescriptionHandle desc, Ptr data);
src
- Contains a handle to the image to be compressed. The image must be stored in a pixel map structure.
srcRect
- Contains a pointer to a rectangle defining the portion of the image to compress.
quality
- Specifies the desired compressed image quality. See "Compression Quality Constants" on page 3-52 for valid values.
cType
- Specifies a compressor type. You must set this parameter to a
valid compressor type (see Table 3-3 on page 3-59 for a list of the available compressor types).desc
- Contains a handle that is to receive a formatted image description structure. The Image Compression Manager resizes this handle for the returned image description structure. Your application should store this image description with the compressed image data.
data
- Points to a location to receive the compressed image data. It is your program's responsibility to make sure that this location can receive at least as much data as indicated by the
GetMaxCompressionSize
function (described on page 3-63). The Image Compression Manager places the actual size of the compressed image into thedataSize
field of the image description structure referred to by thedesc
parameter. This pointer must contain a 32-bit clean address. If you use a dereferenced, locked handle, you must call the Memory Manager'sStripAddress
routine before you use that handle with this parameter (for details onStripAddress
, see Inside Macintosh: Memory).DESCRIPTION
TheCompressImage
function presents a simplified interface to your application, eliminating some parameters for the sake of convenience.RESULT CODES
noErr 0 No error paramErr -50 Invalid parameter specified memFullErr -108 Not enough memory available noCodecErr -8961 The Image Compression Manager could not find the specified compressor SEE ALSO
If you need to exert greater control over the compression operation, use theFCompressImage
function, described in the next section.